package wavenotes.model.presentation;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.json.JSONException;
import org.json.JSONObject;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Slide {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private String notes;
	
	@Persistent
	private String slideUrl;

	public Slide() { }
		
	public JSONObject toJSON() throws JSONException {
		return new JSONObject(this);
	}
	
	public String getEncodedKey() {
		return KeyFactory.keyToString(getKey());
	}	
	
	public Key getKey() {
		return key;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}
	
	public String getSlideUrl() {
		return this.slideUrl;
	}
	
	public void setSlideUrl(String slideUrl) {
		this.slideUrl = slideUrl;
	}
}